<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="inet.db.bongda.adm.AdminRights"%>
<% 
	String admId = (String)session.getAttribute("adm.id");
    String admUsername = (String)session.getAttribute("adm.username");
    String admFullname = (String)session.getAttribute("adm.fullname");
    Long   LadmRight   = (Long)  session.getAttribute("adm.right");

    long admRight = 0;

    String contextPath = request.getContextPath(); //e.g: /web
    
    if (admUsername == null || "".equals(admUsername) ||
    	LadmRight   == null ||
        admFullname == null || "".equals(admFullname)) {
        //response.sendRedirect(contextPath + "/admin/login/login.jsp");
    } else {
        admRight = LadmRight.longValue();
        // Have right to access current path ?
        // By default, administrator has right to access
        // any paths which don't assign policy.
        String path = request.getServletPath(); //e.g: /admin/index.jsp

        path = path.toLowerCase();
        boolean notAllowed = false;
        if (path.indexOf("/admin/tennis/") >= 0 && ((admRight & AdminRights.ADM_RIGHT_PATH_TENNIS) != AdminRights.ADM_RIGHT_PATH_TENNIS)) {
            notAllowed = true;
    	}
    	
        if (notAllowed) response.sendRedirect(request.getContextPath() + "/admin/include/deny.jsp");
    }

    System.out.println(" >>" + admUsername + ": " + request.getRemoteAddr() + " --> " + request.getRequestURI());

%>
<div class="grid_12 header-repeat">
    <div id="branding">
        <div class="floatleft">
            <img src="<%= request.getContextPath() %>/admin/tennis/img/inet-logo.png" alt="Logo" /></div>
        <div class="floatright">
            <div class="floatleft">
                <img src="<%= request.getContextPath() %>/admin/tennis/img/img-profile.jpg" alt="Profile Pic" /></div>
            <div class="floatleft marginleft10">
                <ul class="inline-ul floatleft">
                    <li>Hello <%= admUsername != null ? admUsername:"" %></li>
                    <li><a href="<%=contextPath%>/admin/login/logoff.jsp">Logout</a></li>
                </ul>
                <%--<br />
                <span class="small grey">Last Login: 3 hours ago</span>
            --%></div>
        </div>
        <div class="clear">
        </div>
    </div>
</div>
<div class="clear">
</div>
<div class="grid_12">
    <ul class="nav main">
        <li class="ic-dashboard"><a href="dashboard.html"><span>Trang chủ</span></a> </li>
        <li class="ic-grid-tables"><a href="<%= request.getContextPath() %>/admin/tennis/match/list-match.jsp"><span>Livescore</span></a>
        </li>
        <li class="ic-form-style"><a href="javascript:"><span>Thông tin chung</span></a>
            <ul>
                <li><a href="<%= request.getContextPath() %>/admin/tennis/champion/">Giải đấu</a> </li>
                <li><a href="<%= request.getContextPath() %>/admin/tennis/champion/list-categories.jsp">Thể loại</a> </li>
                <li><a href="<%= request.getContextPath() %>/admin/tennis/champion/list-countries.jsp">Quốc gia</a> </li>
                <li><a href="<%= request.getContextPath() %>/admin/tennis/champion/list-player.jsp">Tay vợt</a> </li>
            </ul>
        </li>
    </ul>
</div>
<div class="clear">
</div>
